package cn.doit.scala.day04

/**
 * @DATE 2021/12/28/15:01
 * @Author MDK
 * @Version 2021.2.2
 * */
object C10_Zip {
  def main(args: Array[String]): Unit = {
    val list: List[String] = List[String]("a", "b", "c", "d")
    val array = Array[Int](1, 2, 3, 4)
    val res: List[(String, Int)] = list.zip(array)
    val res2 = array.zip(list)
    res.foreach(println)
    println("============")
    res2.foreach(println)

    println("============================")
    val res3: Array[(Int, Int)] = array.zipWithIndex
    res3.foreach(println)
    println("============带角标============")
    val index: List[(String, Int)] = list.zipWithIndex
    index.foreach(println)
  }
}
